import axios from '@/libs/request/axios'


// 获取全部角色数据
export const getAllRoleList = (params) => {
    return axios.request({
        url: '/admin/role/getAllList',
        params: params,
        method: 'get'
    })
}
// 分页获取角色数据
export const getRoleList = (params) => {
    return axios.request({
        url: '/admin/role/getAllByPage',
        params: params,
        method: 'get'
    })
}
// 添加角色
export const addRole = (params,userIds=[]) => {
    return axios.request({
        url: '/admin/role/save',
        data: {role:params,userIds:userIds},
        method: 'post'
    })
}
// 编辑角色
export const editRole = (params,userIds=[]) => {
    return axios.request({
        url: '/admin/role/edit',
        data: {role:params,userIds:userIds},
        method: 'post'
    })
}

// 分配角色权限
export const editRolePerm = (params) => {
    return axios.request({
        url: '/admin/role/editRolePerm',
        data: params,
        method: 'post'
    })
}
// 分配角色数据权限
export const editRoleDep = (params) => {
    return axios.request({
        url: '/admin/role/editRoleDep',
        data: params,
        method: 'post'
    })
}
// 删除角色
export const deleteRole = (ids, params) => {
    return axios.request({
        url: `/admin/role/delAllByIds/${ids}`,
        params: params,
        method: 'delete'
    })
}

export const userTransferList=(id)=>{
    return axios.request({
        url: `/admin/user/userTransferList/${id}`,
        method: 'get'
    })
}

